<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:hr="http://java.sun.com/jsf/composite/autocomplete">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">
                <h:form >
                    <p:panel >
                        <f:facet name="header" >
                            <h:outputLabel value="EPF ETF" />
                        </f:facet>
                        <h:panelGrid columns="2" >
                            <h:outputLabel value="Salary Cycle"/>
                            <p:selectOneMenu value="#{hrReportController.reportKeyWord.salaryCycle}" 
                                             var="t">
                                <f:selectItems value="#{salaryCycleController.salaryCycles}" 
                                               var="theme" 
                                               itemLabel="#{theme.name}" 
                                               itemValue="#{theme}" ></f:selectItems>

                                <p:column style="width:10%" headerText="Name">
                                    <h:outputText value="#{t.name}" />
                                </p:column>

                                <p:column headerText="Year">
                                    <h:outputText value="#{t.salaryYear}" />
                                </p:column>
                                <p:column headerText="Month">
                                    <h:outputText value="#{t.salaryMonth}" />
                                </p:column>
                            </p:selectOneMenu>
                            <h:outputLabel value="Institution : "/>
                            <hr:institution value="#{hrReportController.reportKeyWord.institution}"/>
                            <h:outputLabel value="Department : "/>
                            <hr:department value="#{hrReportController.reportKeyWord.department}"/>
                            <h:outputLabel value="Employee : "/>
                            <hr:completeStaff value="#{hrReportController.reportKeyWord.staff}"/>
                            <h:outputLabel value="Staff Category : "/>
                            <hr:completeStaffCategory value="#{hrReportController.reportKeyWord.staffCategory}"/>
                            <h:outputLabel value="Staff Designation : "/>
                            <hr:completeDesignation value="#{hrReportController.reportKeyWord.designation}"/>
                            <h:outputLabel value="Staff Roster : "/>
                            <hr:completeRoster value="#{hrReportController.reportKeyWord.roster}"/>
                            <h:outputLabel value="Blocked"/>
                            <p:selectBooleanCheckbox value="#{hrReportController.blocked}"/>
                            <h:outputLabel value="Hold"/>
                            <p:selectBooleanCheckbox value="#{hrReportController.hold}"/>

                        </h:panelGrid>

                        <p:commandButton ajax="false" value="Process" action="#{hrReportController.createStaffSalaryEPF()}"/>

                        <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >

                            <pe:exporter type="xlsx" target="tb1" fileName="hr_report_staff_epf_etf_to_export"  />
                        </p:commandButton>
                        <p:commandButton value="Print" ajax="false" action="#" >
                            <p:printer target="gpBillPreview" ></p:printer>
                        </p:commandButton>
                        <p:panel id="gpBillPreview" styleClass="noBorder summeryBorder">                     
                            <p:dataTable id="tb1" value="#{hrReportController.staffSalarys}" var="ss">
                                <f:facet name="header">
                                    
                                    <h:outputLabel value="Employee EPF/ETF Report"/>
                                    <br/>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.institution ne null}" >
                                        <h:outputLabel value="#{hrReportController.reportKeyWord.institution.name}" />
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.department ne null}" >
                                        <h:outputLabel value="Department : #{hrReportController.reportKeyWord.department.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.staff.person.name ne null}" >
                                        <h:outputLabel value="Staff : #{hrReportController.reportKeyWord.staff.person.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.roster ne null}" >
                                        <h:outputLabel value="Roster : #{hrReportController.reportKeyWord.roster.name}"/>
                                        <br/>
                                    </h:panelGroup>

                                    <h:outputLabel value="#{hrReportController.reportKeyWord.salaryCycle.salaryFromDate}" rendered="#{hrReportController.reportKeyWord.salaryCycle ne null}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>
                                    To
                                    <h:outputLabel value="#{hrReportController.reportKeyWord.salaryCycle.salaryToDate}" rendered="#{hrReportController.reportKeyWord.salaryCycle ne null}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>

                                </f:facet>
                                <p:column headerText="Nic Number" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Nic Number" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.person.nic}" />
                                </p:column>

                                <p:column headerText="Last Name" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Last Name" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.person.lastName}"/>
                                </p:column>

                                <p:column headerText="Initials">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Initials" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.person.nameWithInitials}" />
                                </p:column>

                                <p:column headerText="Member AC Number">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Member AC Number" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.accountNo}" />
                                </p:column>

                                <p:column headerText="Employer’s Contribution Amount (Rs.)" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Employer’s Contribution Amount (Rs.)" />
                                    </f:facet>
                                    <p:outputLabel value="#{-ss.epfStaffValue}">
                                        <f:convertNumber pattern="0.00" />
                                    </p:outputLabel>
                                    <f:facet name="footer">
                                        <p:outputLabel value="#{-(hrReportController.totalEpfStaffValue)}">
                                            <f:convertNumber pattern="0.00" />
                                        </p:outputLabel> 
                                    </f:facet>
                                </p:column>

                                <p:column headerText="Member’s Contribution Amount (Rs.)" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Member’s Contribution Amount (Rs.)" />
                                    </f:facet>
                                    <p:outputLabel value="#{-(ss.epfCompanyValue+ss.etfCompanyValue)}" >
                                        <f:convertNumber pattern="0.00" />
                                    </p:outputLabel>
                                    <f:facet name="footer">
                                        <p:outputLabel value="#{-(hrReportController.totalEpfCompanyValue+hrReportController.totalEtfCompanyValue)}">
                                            <f:convertNumber pattern="0.00" />
                                        </p:outputLabel> 
                                    </f:facet>
                                </p:column>



                                <p:column headerText="Total Contribution Amount (Rs.)">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Total Contribution Amount (Rs.)" />
                                    </f:facet>
                                    <p:outputLabel value="#{-(ss.epfCompanyValue+ss.etfCompanyValue+ss.epfStaffValue)}">
                                        <f:convertNumber pattern="0.00" />
                                    </p:outputLabel>
                                    <f:facet name="footer">
                                        <p:outputLabel value="#{-(hrReportController.totalEpfCompanyValue+hrReportController.totalEtfCompanyValue+hrReportController.totalEpfStaffValue)}">
                                            <f:convertNumber pattern="0.00" />
                                        </p:outputLabel> 
                                    </f:facet>
                                </p:column>



                                <p:column headerText="Total Earnings (Rs.)">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Total Earnings (Rs.)" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.basicValue}">
                                        <f:convertNumber pattern="0.00" />
                                    </p:outputLabel> 
                                    <f:facet name="footer">
                                        <p:outputLabel value="#{hrReportController.totalBasicValue}">
                                            <f:convertNumber pattern="0.00" />
                                        </p:outputLabel> 
                                    </f:facet>
                                </p:column>

                                <p:column headerText="Member Status">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Member Status" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.employeeStatus.label}" />
                                </p:column>

                                <p:column headerText="Zone code">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Zone code" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.person.zoneCode}" />
                                </p:column>

                                <p:column headerText="Employer Number">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Employer Number" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.codeInterger}"/>
                                </p:column>

                                <p:column headerText="Contribution Year Month">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Contribution Year Month" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.dateJoined}">
                                        <f:convertDateTime pattern="YYYY/MM"></f:convertDateTime>
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Data Submission Number">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Data Submission Number" />
                                    </f:facet>
                                    <p:outputLabel value="1"/>
                                </p:column>

                                <p:column headerText="No.of days worked">
                                    <f:facet name="header" >
                                        <p:outputLabel value="No.of days worked" />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.transWorkedDays}" >
                                        <f:convertNumber pattern="0.00" />
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Occupation Classification Grade(As per the classification of censes  and statistic Dept) ">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Occupation Classification Grade(As per the classification of censes  and statistic Dept) " />
                                    </f:facet>
                                    <p:outputLabel value="#{ss.staff.grade.name}"/>
                                </p:column>

                                <f:facet name="footer">
                                    <p:outputLabel value="Print By : #{sessionController.loggedUser.webUserPerson.name} - " />
                                    <p:outputLabel value="Print At : " />
                                    <p:outputLabel value="#{commonController.currentDateTime}" >
                                        <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a " />
                                    </p:outputLabel>
                                </f:facet>
                            </p:dataTable>
                        </p:panel>


                    </p:panel>

                </h:form>
            </ui:define>

        </ui:composition>

    </h:body>
</html>
